home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 15053 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: news.crystalball.com!news
  2. From: Larry Weiss <lfw@oc.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: #include "" for large programs.
  5. Date: Tue, 16 Apr 1996 15:10:34 -0500
  6. Organization: ...
  7. Message-ID: <3173FEBA.15E6@oc.com>
  8. References: <Pine.SUN.3.92.960411195730.24973A-100000@suntan> <4kmbnr$89@newshost.cyberramp.net>
  9. NNTP-Posting-Host: external.oc.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.01 (Win95; I)
  14. CC: lfw@oc.com
  15.  
  16. John L. Noland wrote:
  17.  > 
  18.  > #include "part2.h"
  19.  > this tells it to look in the current working directory. 
  20.  > 
  21.  
  22. Actually, all the search semantics of the #include directive are implementation
  23. defined for both <> and "" formats.   So any interpretation is highly
  24. dependant on the documentation supplied with the implementation and the
  25. standard does not distinguish between the two forms except to say that
  26. if the two are defined to be different and the "" form is used, then if
  27. the "" form fails to resolve, then the <> rules are tried.
  28.  
  29. I avoid the "" form if at all possible because the "current working directory"
  30. type rules that you mention can get you into trouble in some common
  31. implementations when you employ nested #includes.   The problem is that the 
  32. "current working directory" is defined with respect to the directory containing
  33. the file that contains the #include directive (which may be an included file
  34. itself and not one resident in the same directory containing the original
  35. source file) and this can result in different files being used to resolve the
  36. same named header file in different modules of the same program.   Again, this
  37. is a description of implementation defined semantics, and is not necessarily the 
  38. only implementation.   But most UNIX and PC compilers define it this harzardous 
  39. way.
  40.